#include <QtPlugin>

#include <QVBoxLayout>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QPushButton>
#include <QFileDialog>

#include <opencv/cv.h>
#include <opencv/highgui.h>

#include "QCVModuleInterface.h"
#include "QCVModuleHandlerInterface.h"

#ifndef MODULE_VJ_OBJECT_DETEC
#define MODULE_VJ_OBJECT_DETEC

class ModuleVJObjectDetection:public QObject,QCVModuleInterface
{
  Q_OBJECT
	Q_INTERFACES(QCVModuleInterface)
	
	public:
		void init(QCVModuleHandlerInterface * parent);
		void free();

		cv::Mat & process();
		void setInput(int n,const cv::Mat & m);

		QWidget* widget();
		QString getName();
		int nbInputs();
		QString help(int id);
		bool setParams(QString params);
    QString getParams();

		QCVModuleInterface * clone();

	public slots:
		void s_browse();

	private:  

    QWidget * win;
    QGridLayout * layout;
		
		cv::Mat currentFrame;
		cv::Mat_<int> boxes;
	
		cv::CascadeClassifier cascade;

		QLabel * l_classifierFile;
		QLabel * l_scale;
		QLabel * l_scaleStep;
		QLabel * l_neighbors;
		QLabel * l_minSize;

		QLineEdit * le_classifierFile;
		QDoubleSpinBox * sb_scale;
		QSpinBox * sb_scaleStep;
		QSpinBox * sb_neighbors;
		QSpinBox * sb_minSizeX;
		QSpinBox * sb_minSizeY;

		QPushButton * pb_browse;

		QCVModuleHandlerInterface * parent;
};

#endif
